<template>
  <IFexHeaderMain>
    <template #header>
      <IHeader>首页</IHeader>
    </template>
    <view class="home_main whov">
      <IScrollView :scrollData="scrollData" @selectDataList="selectDataList">
        <template #default>
          <HeaderSwiper />
          <OperateSwiper />
          <GoodList ref="goodRef" />
        </template>
      </IScrollView>
    </view>
    <template #footer><ITabBar /></template>
  </IFexHeaderMain>
</template>

<script setup lang="ts" name="index">
import { onMounted, ref } from "vue";
import ITabBar from "@/components/container/ITabBar.vue";
import IFexHeaderMain from "@/components/container/IFexHeaderMain.vue";
import IScrollView from "@/components/container/IScrollView.vue";
import IHeader from "@/components/container/IHeader.vue";
import OperateSwiper from "./components/OperateSwiper.vue";
import HeaderSwiper from "./components/HeaderSwiper.vue";
import GoodList from "./components/GoodList.vue";
import { getGoodList } from "@/api/good";
import  useUserInfoStore from "@/store/userInfo";
const goodRef = ref(); // 数据值
const selectDataList = (list: any, data: any) => goodRef.value.init(data);
const scrollData = ref({
  callback: async (param: any) =>
    await getGoodList({
      current: param.current,
      size: param.size,
      categoryId: "1822961748494692353",
    }),
});
onMounted(() => {
  const userInfoStore = useUserInfoStore();
  console.log("userInfoStore", userInfoStore.getUserInfo);
  // proxy.$toast('这是一个 Toast 提示123123', 3000);
});
</script>

<style scoped>
.home_main {
  /* margin: 0 10px; */
  background: #ffffff;
}
</style>
